﻿/******************************************************************************
 * GPatentTypes.cs
 * 
 * This module implements the DataContract types needed to query Google Patents
 * 
 * Date:   12/2008
 * 
 * Copyright (c) 2009, 2010, Mark Betz 
 * 
 * All rights reserved. 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met: 
 * 
 *   * Redistributions of source code must retain the above copyright 
 *     notice, this list of conditions and the following disclaimer. 
 *   * Redistributions in binary form must reproduce the above copyright 
 *     notice, this list of conditions and the following disclaimer in the 
 *     documentation and/or other materials provided with the distribution. 
 *   * Neither the name of the Author nor the names of contributors may be 
 *     used to endorse or promote products derived from this software
 *     without specific prior written permission. 
 *     
 * THIS SOFTWARE IS PROVIDED BY MARK BETZ ''AS IS'' AND ANY  EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 * IN NO EVENT SHALL MARK BETZ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 * 
 */
using System;
using System.Runtime.Serialization;

namespace GSearch
{
    /// <summary>
    /// Implements the patent-specific portion of the Google result json object
    /// </summary>
    [DataContract]
    public class GPatentResults : GResults
    {
        /// <summary>
        /// A System.String containing the title of the patent. May contain
        /// HTML formatting.
        /// </summary>
        [DataMember(Name = "title")]
        public string Title { get; set; }

        /// <summary>
        /// A System.String containing the title of the patent, without
        /// any HTML formatting.
        /// </summary>
        [DataMember(Name = "titleNoFormatting")]
        public string TitleNoFormatting { get; set; }

        /// <summary>
        /// A System.String containing an HTML-formatted snippet of content
        /// describing the patent.
        /// </summary>
        [DataMember(Name = "content")]
        public string Content { get; set; }

        /// <summary>
        /// A System.String containing the URL address of the full patent
        /// description, without escape characters.
        /// </summary>
        [DataMember(Name = "unescapedUrl")]
        public string UnescapedUrl { get; set; }

        /// <summary>
        /// A System.String containing the URL address of the full patent
        /// description, with escape characters.
        /// </summary>
        [DataMember(Name = "url")]
        public string Url { get; set; }

        /// <summary>
        /// A System.String containing the date that the patent application
        /// was filed, if patentStatus == 'filed', otherwise contains the
        /// date that the patent was issued.
        /// </summary>
        [DataMember(Name = "applicationDate")]
        public string ApplicationDate { get; set; }
        
        /// <summary>
        /// A System.String containing the patent number, if patentStatus
        /// == issued, otherwise contains the application number.
        /// </summary>
        [DataMember(Name="patentNumber")]
        public string PatentNumber { get; set; }

        /// <summary>
        /// A System.String containing 'filed' if the patent application has
        /// been filed, otherwise contains 'issued' if the patent has been
        /// issued.
        /// </summary>
        [DataMember(Name = "patentStatus")]
        public string PatentStatus { get; set; }

        /// <summary>
        /// A System.String containing the name of the person or organization
        /// to whom the patent rights are assigned.
        /// </summary>
        [DataMember(Name = "assignee")]
        public string Assignee { get; set; }

        /// <summary>
        /// A System.String containing the URL address of a descriptive image
        /// associated with this patent. Typically this is a scan of a drawing
        /// page, or title page.
        /// </summary>
        [DataMember(Name = "tbUrl")]
        public string TbUrl { get; set; }
    }

    /// <summary>
    /// Implements the patent-specific portion of the Google responseData json object
    /// </summary>
    [DataContract]
    public class GPatentResponseData : GResponseData
    {
        /// <summary>
        /// Returns an array of <see cref="GSearch.GPatentResults"/> containing the
        /// patents returned by the search.
        /// </summary>
        [DataMember(Name = "results")]
        public GPatentResults[] Results { get; set; }
    }

    /// <summary>
    /// Implements the patent-specific portion of the Google response json object
    /// </summary>
    [DataContract]
    public class GPatentResponse : GResponse
    {
        /// <summary>
        /// Returns an instance of <see cref="GSearch.GPatentResponseData"/> containing
        /// the results of a patent search.
        /// </summary>
        [DataMember(Name = "responseData")]
        public GPatentResponseData Response { get; set; }
    }
}